package cn.skyquant.quant4j.task.boot.mvc;


import cn.skyquant.quant4j.api.dto.ResultDTO;
import cn.skyquant.quant4j.task.boot.bo.TestBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    TestBO testBO;

    @RequestMapping(value = "/t", method = RequestMethod.GET)
    @ResponseBody
    public ResultDTO testTransactional() {
        int[] id = testBO.insertWithTrans();
        //理论上两条都不能插入成功
//        return "testTransactional" + id[0] + id[1];
        return ResultDTO.success(id);
    }

    @RequestMapping(value = "/nt", method = RequestMethod.GET)
    @ResponseBody
    public String testNoTransactional() {
        return "hello11";
    }

}
